Formatted Number
Display numerical data
#Examples
Clearly and consistently display numerical data in a user-friendly format, making it easier for users to interpret and understand key information.
<FormattedNumber number={1234567.89} locale="en-US" />
#Format
This component supports three display formats:
- Number: For standard numerical values (e.g.: counts and metrics).
- Percent: For expressing proportions or rates (e.g.: conversion rates, and total increase of page views).
- Currency: For financial values, automatically applying the appropriate currency symbol (e.g.: $, €, ¥).
If no format is provided, the number will default to plain numbers. Read more in Understanding Number Formats
USD1,234,567.89
1,234,567.89
<FormattedNumber number={1234567.89} locale="en-US" format="percent" />
<br />
<FormattedNumber number={1234567.89} locale="en-US" format="currency" />
<br />
<FormattedNumber number={1234567.89} locale="en-US" format="number" />
#Locale
The locale
parameter controls the number formatting based on regional standards (e.g.: using commas or periods as decimal separators). All standard locale codes from the ECMAScript Internationalization API are supported.
1,234,567.89
1.234.567,89
<FormattedNumber number={1234567.89} locale="da-DK" format="number" />
<br />
<FormattedNumber number={1234567.89} locale="en-US" format="number" />
<br />
<FormattedNumber number={1234567.89} locale="pt-BR" format="number" />
#Digits
Control the number of digits displayed. The default maximum significant digits is 2.
1.200
1.25
1.247
<FormattedNumber number={1.2} locale="en-US" format="number" digits={3} />
<br />
<FormattedNumber number={1.2} locale="en-US" format="number" digits={3} alwaysShowDigits />
<br />
<FormattedNumber number={1.2468} locale="en-US" format="number" />
<br />
<FormattedNumber number={1.2468} locale="en-US" format="number" digits={3} alwaysShowDigits />
#Currency
When using the currency format, specify the currency code (e.g.: 'USD', 'EUR'). The default is 'USD'.
<FormattedNumber number={1234567.89} format="currency" currency="AUD" />
#Empty number
If the provided number is empty or invalid, a placeholder (e.g.: '-') will be displayed with an appropriate aria-label for accessibility.
<FormattedNumber number={null} />
#Guidelines
#Best practices
#Do not use when
#Accessibility
Explore detailed guidelines for this component: Accessibility Specifications